<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
    <title>收件箱</title>
    <%@ include file="../../include/head.jsp"%>
</head>
<body>
<div class="admin-content">
    <div class="am-g">
        <div class="am-u-sm-12">
            <div class="am-panel-group" id="accordion">
                <div class="am-panel am-panel-default">
                    <div class="am-panel-hd">
                        <h4 class="am-panel-title" data-am-collapse="{parent: '#accordion', target: '#tab1'}">
                            查询条件
                        </h4>
                    </div>
                    <div id="tab1" class="am-panel-collapse am-collapse am-in">
                        <div class="am-panel-bd">
                            <form id="searchForm" class="am-form-inline" method="post">
                                <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                <div class="am-form-group">
                                    <input type="text" name="key" value="${page.key}" placeholder="标题/内容" class="am-form-field">
                                </div>
                                <div class="am-form-group">
                                    <button type="submit" class="am-btn am-btn-success" onclick="initSearchForm()"><i class="am-icon-search"></i> 查询</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <div class="am-panel am-panel-default">
                <div class="am-panel-hd">
                    <h4 class="am-panel-title">
                        信息列表
                        <div class="am-btn-group am-btn-group-xs iu-right" style="margin-left: 10px;">
                            <a href="${ctx}/msgSend?type=${page.entity.type}&status=1" class="am-btn am-btn-default ${page.entity.status=='1'?'am-active':''}">已发送</a>
                            <a href="${ctx}/msgSend?type=${page.entity.type}&status=0" class="am-btn am-btn-default ${page.entity.status=='0'?'am-active':''}">草稿</a>
                        </div>

                        <div class="am-btn-group am-btn-group-xs iu-right" style="margin-left: 10px;">
                            <a href="${ctx}/msgReceive?msgSend.type=${page.entity.type}&status=-1" class="am-btn am-btn-default ${page.entity.status=='-1'?'am-active':''}">全部</a>
                            <a href="${ctx}/msgReceive?msgSend.type=${page.entity.type}&status=0" class="am-btn am-btn-default ${page.entity.status=='0'?'am-active':''}">未读</a>
                            <a href="${ctx}/msgReceive?msgSend.type=${page.entity.type}&status=1" class="am-btn am-btn-default ${page.entity.status=='1'?'am-active':''}">已读</a>
                        </div>

                        <shiro:hasPermission name="msgSend:create">
                            <button type="button" class="am-btn am-btn-primary am-btn-xs iu-right"
                                    onclick="openModel('新增','${ctx}/msgSend/create?type=${page.entity.type}')"><span class="am-icon-plus"></span> 新增
                            </button>
                        </shiro:hasPermission>
                    </h4>
                </div>
                <div class="am-panel-collapse am-collapse am-in">
                    <div class="am-panel-bd">
                        <div class="am-g">
                            <div class="am-u-sm-12">
                                <table class="am-table am-table-striped am-table-hover table-main">
                                    <thead>
                                    <tr>
                                        <th>序号</th>
                                        <th>标题</th>
                                        <th>级别</th>
                                        <th>状态</th>
                                        <th>操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <c:forEach items="${page.list}" var="msgSend" varStatus="status">
                                        <tr>
                                            <td>${status.index+1}</td>
                                            <td>${msgSend.title}</td>
                                            <td><c:choose><c:when test="${msgSend.levels==1}">高</c:when><c:when test="${msgSend.levels==-1}">低</c:when><c:otherwise>普通</c:otherwise></c:choose></td>
                                            <td><c:choose><c:when test="${msgSend.status=='1'}">已发送</c:when><c:otherwise>草稿</c:otherwise></c:choose></td>
                                            <td>
                                                <div class="am-btn-toolbar">
                                                    <div class="am-btn-group am-btn-group-xs">
                                                        <shiro:hasPermission name="msgSend:create"><c:if test="${page.entity.status=='0'}"><button class="am-btn am-btn-default am-btn-xs am-text-secondary" onclick="openModel('编辑','${ctx}/msgSend/create?id=${msgSend.id}')"><span class="am-icon-pencil-square-o"></span> 编辑</button></c:if></shiro:hasPermission>
                                                        <shiro:hasPermission name="msgSend:delete"><button class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only" onclick="iuConfirm('确认要删除该条数据吗？', '${ctx}/msgSend/delete?id=${msgSend.id}&pageNo=${page.pageNo}&pageSize=${page.pageSize}')"><span class="am-icon-trash-o"></span> 删除</button></shiro:hasPermission>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </c:forEach>
                                    </tbody>
                                </table>
                            </div>
                            <div class="am-u-sm-12">
                                <%@ include file="../../utils/pagination.jsp" %>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<%@ include file="../../include/bottom.jsp"%>
<script type="text/javascript">
    $(document).ready(function () {
        var msg = '${msg}';
        if(msg!=''){
            iuMsg(msg);
        }
    });
</script>
</body>
</html>
